package com.oraclechain.pocketeos.blockchain;

import java.io.Serializable;

/**
 * 钱包账户的种类，目前只支持EOS和原力
 */
public enum WalletAccountType implements Serializable {
    ALL(0),
    EOSCOIN(1),
    EOS(2),
    TELOS(3),
    BOS(4),
    MEETONE(5),
    CDX(7),
    VEX(8);

    public final int id;

    WalletAccountType(int id) {
        this.id = id;
    }

    /**
     * 获取钱包名字
     */
    public static String getWalletName(WalletAccountType accountType) {
        String name = "";
        switch (accountType) {
            case EOSCOIN:
                name = "EOSC";
                break;
            case EOS:
                name = "EOS";
                break;
            case TELOS:
                name = "TELOS";
                break;
            case BOS:
                name = "BOS";
                break;
            case MEETONE:
                name = "MEETONE";
                break;
            case CDX:
                name = "CODEX";
                break;
            case VEX:
                name = "VEX";
                break;
        }
        return name;
    }

    /**
     * 根据TYPE获取ID，原力和EOS需要强制换一下，防止影响旧版本用户
     */
    public static String getId(WalletAccountType accountType) {
        String id = "";
        if (accountType != null) {
            switch (accountType) {
                case EOSCOIN:
                    id = "2";
                    break;
                case EOS:
                    id = "1";
                    break;
                default:
                    id = accountType.id + "";
            }
        }
        return id;
    }

    /**
     * 根据TYPE获取ID，原力和EOS需要强制换一下，防止影响旧版本用户
     */
    public static WalletAccountType getWalletAccountType(int id) {
        switch (id) {
            case 1:
                return EOS;
            case 2:
                return EOSCOIN;
            default:
                for (WalletAccountType walletAccountType : WalletAccountType.values()) {
                    if (walletAccountType.id == id) {
                        return walletAccountType;
                    }
                }
        }
        return EOS;
    }

    /**
     * 获取钱包图标
     */
    public static int getWalletIconResId(WalletAccountType accountType) {
        int resId = 0;
        return resId;
    }

//    public static String getChainName(WalletAccountType accountType) {
//        String name = "";
//        switch (accountType) {
//            case EOSCOIN:
//                name = "EOS Force";
//                break;
//            case EOS:
//                name = "EOS";
//                break;
//            case TELOS:
//                name = "TELOS";
//                break;
//            case BOS:
//                name = "BOS";
//                break;
//            case MEETONE:
//                name = "MEETONE";
//                break;
//            case CDX:
//                name = "CDX";
//                break;
//            case VEX:
//                name = "VEX";
//                break;
//        }
//        return name;
//    }

    /**
     * 获取链名字
     */
    public static String getChainCoinName(WalletAccountType accountType) {
        String name = "";
        switch (accountType) {
            case EOSCOIN:
                name = "EOSC";
                break;
            case EOS:
                name = "EOS";
                break;
            case TELOS:
                name = "TLOS";
                break;
            case BOS:
                name = "BOS";
                break;
            case MEETONE:
                name = "MEETONE";
                break;
            case CDX:
                name = "CDX";
                break;
            case VEX:
                name = "VEX";
                break;
        }
        return name;
    }
}
